#include "Core/Array/List.h"
#include "ListTest.h"

const char * ListTest::GetName() const
{
	return "List Test";
}

error ListTest::Create()
{
	if(Failed(UnitTest::Create()))
		return errFailed;

	return errOK;
}

error ListTest::Destroy()
{
	if(Failed(UnitTest::Destroy()))
		return errFailed;

	return errOK;
}

error ListTest::Execute()
{
	List<int> list;
	if(list.Begin()!=list.End())
		return errFailed;

	list.Insert(9);
	list.Insert(2);
	list.Insert(3);
	list.Insert(4);

	list.Begin()->SetValue(1);

	for(List<int>::Iterator it=list.Begin(); it!=list.End(); it=it->Next())
	{
		(*it)+=1;
	}

	if((*list.Begin())!=2)
		return errFailed;

	List<int> list2(list);
	if(list2!=list)
		return errFailed;

	return errOK;
}
